<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Vue list的过渡</title>
    <script charset="UTF-8" src="js/vue.js"></script>
</head>
<style>
    .fade-enter,.fade-leave-to{
        opacity: 0;
    }
    .fade-enter-active,.fade-leave-active{
        transition: opacity 1s;
    }
</style>
<body>
<div id="app">
    <transition-group name="fade">
        <div v-for="(item,index) of lists" :key="item.id">
            {{item.title}}
        </div>
    </transition-group>
    <button @click="handleBtnClick">add</button>
</div>
<script>
    let count=0;
    let vm = new Vue({
        el: '#app',
        data: {
            lists:[]
        },
        methods:{
            handleBtnClick:function () {
                this.lists.push({
                    id: count++,
                    title:'hello world'
                })
            }
        }
    });
</script>
</body>
</html>